from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
# 初始化WebDriver（假设使用Chrome）
service = Service(executable_path=r'F:\chromedriver-win64\chromedriver.exe')

driver = webdriver.Chrome(service=service)


# 打开目标网页
#https://www.cmde.org.cn//flfg/guizh/20220323135600670.html
driver.get('https://baijiahao.baidu.com/s?id=1818559222875714524')
time.sleep(2)  # 等待页面加载
# 根据class名称查找元素
element = driver.find_element(By.CLASS_NAME, "_18p7x")
# 输出元素文本内容
print(element.text)

# 关闭浏览器
driver.quit()